Skip to content

feat(service): add Mailtrap email service#1045

Open
tsokolovs wants to merge 3 commits into
nikoksr:mainfrom
tsokolovs:feat/add-mailtrap-service
Open

feat(service): add Mailtrap email service#1045
tsokolovs wants to merge 3 commits into
nikoksr:mainfrom
tsokolovs:feat/add-mailtrap-service

Conversation

@tsokolovs

@tsokolovs tsokolovs commented Jul 6, 2026

Copy link
Copy Markdown

Description

This PR adds a new notification service for Mailtrap, an email delivery platform for developers.

The service sends transactional emails through the Mailtrap Email API.

Motivation and Context

Mailtrap is a widely used email delivery/testing platform, but notify had no Mailtrap service — users had to fall back to the generic SMTP mail service. This adds first-class support alongside the other email providers (sendgrid,
mailgun). It uses only the Go standard library (net/http), so it introduces no new dependencies.

How Has This Been Tested?

Table-driven unit tests (service/mailtrap/mailtrap_test.go) using httptest.Server to assert the request method, path, Api-Token/Content-Type headers, and JSON body for both HTML and plain-text sends, plus constructor/options/error-status cases (93% coverage). Verified locally with make ci (golangci-lint clean, full go test -race ./... passing) and make fmt.

I've also tested both the Sandbox and live versions by sending them to myself.

Types of changes

  • New feature (non-breaking change which adds functionality)
  • Documentation (no code change)

Checklist:

  • My code follows the code style of this project.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Add a new notification service that sends transactional emails through
the Mailtrap Email Sending API. The service uses only the Go standard
library (net/http), so it introduces no new dependencies.

It follows the conventions of the existing email services (sendgrid,
mailgun): a New constructor, AddReceivers, a BodyFormat toggle (HTML by
default, PlainText opt-out) and a Send method. Functional options cover
the sender display name, bulk and sandbox hosts, a custom host, and a
custom HTTP client.

Includes table-driven unit tests (httptest-based) and a service README.
@tsokolovs
tsokolovs force-pushed the feat/add-mailtrap-service branch from cd0769c to 6c2527a Compare July 6, 2026 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant